<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>商品管理-商品添加</title>
<link href="/resource/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript" src="/resource/js/jquery.min.js"></script>
<script type="text/javascript"
		src="/resource/js/bootstrap.min.js"></script>
<script src="/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/resource/js/jquery.form.js"></script>
</head>
<body>
<div>
	<ul class="breadcrumb" style="margin: 0px;">
		<li>系统管理</li>
		<li>商品管理</li>
		<li>商品添加</li>
	</ul>
</div>
<form id="goodsform" action="/back/goodsinfo/add" method="post" class="form-horizontal">
	<h5 class="page-header alert-info"
		style="margin: 0px; padding: 10px; margin-bottom: 10px;">基本信息</h5>
	<!-- 开始1 -->
	<div class="row">
		<div class="col-xs-5">
			<div class="form-group ">
				<label class="col-xs-3 control-label">商品名称</label>
				<div class="col-xs-9 ">
					<input type="text" name="goodsName" class="form-control" placeholder="请输入商品名称" />
				</div>
			</div>
		</div>
		<div class="col-xs-5">
			<div class="form-group ">
				<label class="col-xs-3 control-label">商品价格</label>
				<div class="col-xs-9 ">
					<input type="text" name="goodsPrice" class="form-control" placeholder="请输入商品价格" />
				</div>
			</div>
		</div>
	</div>
	<!--结束1 -->
	<!-- 开始2 -->
	<div class="row">
		<div class="col-xs-5">
			<div class="form-group ">
				<label class="col-xs-3 control-label">商品图片</label>
				<div class="col-xs-9 ">
					<input type="file" name="upload" class="form-control" onchange="uploadImg()"/>
				</div>
			</div>
		</div>
		<div class="col-xs-5">
			<div class="form-group ">
				<label class="col-xs-3 control-label">图片预览</label>
				<div class="col-xs-9 ">
					<img alt="" id="goodsimg" src="" style="width:100px;height:150px;object-fit:contain">
					<input type="hidden" name="goodsUrl" id="goodsUrl">
				</div>
			</div>
		</div>
	</div>
	<!--结束2 -->


	<h5 class="page-header alert-info"
		style="margin: 0px; padding: 10px; margin-bottom: 10px;">商品简介</h5>
	<!-- 开始5 -->
	<div class="row">
			<div class="form-group ">
				<label class="col-xs-2 control-label">商品简介</label>
				<div class="col-xs-10 ">
					<textarea name="goodsIntro" rows="" class="col-xs-12 " cols=""></textarea>
				</div>
			</div>
	</div>
	<!--结束5 -->
	
	<h5 class="page-header alert-info"
		style="margin: 0px; padding: 10px; margin-bottom: 10px;">商品详情</h5>
	<!-- 开始5 -->
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group ">
				<textarea rows="" name="goodsDesc" class="ckeditor" cols=""></textarea>
			</div>
		</div>
	</div>
	<!--结束6 -->

	<div class="row">
		<div class="col-xs-3 col-xs-offset-4">
			<input type="submit" class="btn btn-success" value="保存商品" /> <input
				type="reset" class="btn btn-danger" value="重置信息" />
		</div>
	</div>

</form>

<script type="text/javascript">
	function uploadImg(){
		var options={
				url:"/back/goodsinfo/uploadimg",
				type:"post",
				success:function(data){
					$("#goodsimg").attr("src",data);
					$("#goodsUrl").val(data);
				}
		}
		$("#goodsform").ajaxSubmit(options);
	}
</script>
</body>
</html>